/*-
 * Copyright (c) 2006, 2007 FTS Team
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 4. Neither the name of the FTS Team nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *      DocumentStorage.hpp
 *
 * $FTS$
 */
#ifndef _DOCUMENT_STORAGE_HPP__
#define _DOCUMENT_STORAGE_HPP__ 1

/**
  @file DocumentStorage.hpp
  @brief Document storage
*/
#include <FTS.hpp>
#include <Document.hpp>

namespace FTSS // FullTextSearchSystem
{

/**
  @class DocumentStorage DocumentStorage.hpp <DocumentStorage.hpp>
  @brief Document data base storage
*/
class DocumentStorage
{
public:
	/**
	  @brief A Destructor
	*/
	virtual ~DocumentStorage() throw() { ;; }

	/**
	  @brief Get document by specified ID
	  @return Pointer to the document or NULL if document does not exist
	*/
	virtual Document * GetDocument(const DocumentId_t & iDocumentId) = 0;

	/**
	  @brief Store document information
	  @param pDocument - pointer to the document
	  @return Storage document id
	*/
	virtual DocumentId_t StoreDocument(const Document * pDocument) = 0;

	/**
	  @brief Store document as set of his parts
	  @param aParts - parts of document
	  @param iPartsSize - size of parts
	  @param aIndex - index with term offsets
	  @param iIndexSize - size of index
	  @param iTextSize - size of text data
	  @param sText - text data
	  @param iTextSize - size of text data
	  @return Storage document id
	*/
	virtual DocumentId_t StoreDocumentParts(const DocumentPart   * aParts,
	                                        const UINT_32        & iPartsSize,
	                                        const DocumentIndex  * aIndex,
	                                        const UINT_32        & iIndexSize,
	                                        const UCCHAR_P         sText,
	                                        const UINT_32        & iTextSize) = 0;

};

} // namespace FTSS
#endif // _DOCUMENT_STORAGE_HPP__
// End.
